import com.powerfl.frm.taf.*;

public var _paramTweenVar:TAFtweenVar;
private var _paramTweenCurrVar:TAFtweenVar;

private function paramTweenVarSet():void{
	if( SELF._paramTweenVar === null ){
		SELF._paramTweenCurrVar = SELF._paramTweenVar = poolPullTweenVar();
	}
}
final public function $tween():String{
	paramTweenVarSet();
	return '@@TAFtweenVar';
}
final public function $NEXT( ...$param ):String{
	paramTweenVarSet();
	if( $param.length ){
		SELF._paramTweenCurrVar.to = $paramGet( $param ).param;
	}else{
		SELF._paramTweenCurrVar.to = SELF._paramAwayVar;
		SELF._paramTweenCurrVar.next = poolPullTweenVar();
		SELF._paramTweenCurrVar = SELF._paramTweenCurrVar.next; 
		SELF._paramAwayVar = null;
	}
	return '@@TAFtweenVar';
}
//-----------------------------------------------------------------------------------------------------------------------------------------
final public function $loop( $loop:int, $loopDelay:Number = 0, $isYoyo:Boolean = false ):String{
	paramTweenVarSet();
	if( $isYoyo ){
		SELF._paramTweenCurrVar.yoyo = -1;
	}else{
		SELF._paramTweenCurrVar.yoyo = 0;
	}
	SELF._paramTweenCurrVar.loop = $loop - 1;
	SELF._paramTweenCurrVar.loopDelay = $loopDelay*1000;
	return '@@TAFtweenVar';
}
final public function $time( $time:Number = -2147483648, $delay:Number = -2147483648 ):String{
	paramTweenVarSet();
	if( $time !== $NONE ){
		SELF._paramTweenCurrVar.time = 1/($time*1000);
	}
	if( $delay !== $NONE ){
		SELF._paramTweenCurrVar.delay = $delay*1000;
	}
	return '@@TAFtweenVar';
} 
//-----------------------------------------------------------------------------------------------------------------------------------------
final public function $end( ...$param ):String{
	paramTweenVarSet();
	if( $param.length ){
		SELF._paramTweenCurrVar.end = $param;
	}
	return '@@TAFtweenVar';
}	
final public function $update( ...$func$param ):String{
	paramTweenVarSet();
	var i:int, j:int, result:Array;
	result = [];
	j = $func$param.length;
	if( j === 1 ){
		$func$param[1] = null;
	}
	for( i = 0 ; i < j ; i += 2 ){
		if( $func$param[i] is String ){
			$func$param[i] = TAF.SELF.flowGet( $func$param[i] );
		}
	}
	SELF._paramTweenCurrVar.update = $func$param;
	return '@@TAFtweenVar';
}

//-----------------------------------------------------------------------------------------------------------------------------------------
final public function $eCIO():String{
	paramTweenVarSet();
	SELF._paramTweenCurrVar.ease = TAFtween.cio; 
	return '@@TAFtweenVar';
}
final public function $eCII():String{
	paramTweenVarSet();
	SELF._paramTweenCurrVar.ease = TAFtween.cii;
	return '@@TAFtweenVar';
}
final public function $eLIN():String{
	paramTweenVarSet();
	SELF._paramTweenCurrVar.ease = TAFtween.lin;
	return '@@TAFtweenVar';
}
final public function $eBOO():String{
	paramTweenVarSet();
	SELF._paramTweenCurrVar.ease = TAFtween.boo;
	return '@@TAFtweenVar';
}
final public function $eBOI():String{
	paramTweenVarSet();
	SELF._paramTweenCurrVar.ease = TAFtween.boi;
	return '@@TAFtweenVar';
}
final public function $eBAO():String{
	paramTweenVarSet();
	SELF._paramTweenCurrVar.ease = TAFtween.bao;
	return '@@TAFtweenVar';
}
final public function $eBAI():String{
	paramTweenVarSet();
	SELF._paramTweenCurrVar.ease = TAFtween.bai;
	return '@@TAFtweenVar';
}
//case'@path':
//temp = $target[i][key];
//path = [];
//for( k = 3, l = temp.length ; k < l ; k += 3 ){
//	path.push( temp[k], temp[k+1], temp[k+2] );
//}
//_targets[i].path = makePathAnimation( makePath( path, temp[2] ), _object );
//_targets[i].path.alignToPath = temp[0];
//if( temp[1] ){
//	_targets[i].path.offset = new Vector3D( temp[1][0], temp[1][1], temp[1][2] );
//}
//break;
//final public function $path( $isContinuous:Boolean, $offSet:Array, $isSmooth:Boolean, ...$points ):Object{
//	return {'@path':[$isContinuous, $offSet, $isSmooth].concat( $points )}
//}